<table class="table table-responsive" id="goodsEvaluates-table">
    <thead>
        <th>Order Id</th>
        <th>商品名称</th>
        <th>规格名称</th>
        <th>评分</th>
        <th>内容</th>
        <th>用户昵称</th>
        <th>回复</th>
        <th>图片</th>
        <th>是否匿名</th>
        <th colspan="3">操作</th>
    </thead>
    <tbody>
    @foreach($goodsEvaluates as $goodsEvaluate)
        <tr>
            <td>{!! $goodsEvaluate->order_id !!}</td>
            <td>{!! $goodsEvaluate->goods->name !!}</td>
            <td>{!! $goodsEvaluate->attribute?$goodsEvaluate->attribute->name:'' !!}</td>
            <td>{!! $goodsEvaluate->level !!}</td>
            <td><span style="font-size: 12px">{!! $goodsEvaluate->content !!}</span></td>
            <td>{!! $goodsEvaluate->user->nickname !!}</td>
            <td><span style="font-size: 12px">{!! $goodsEvaluate->reply !!}</span></td>
            <td>
            <?php
            $pics = json_decode($goodsEvaluate->pictures,true);
            $pics = $pics?$pics:[];
            ?>
            @foreach($pics as $pp)
                <img src='{{$pp}}' alt='' style='width: 30px'>
            @endforeach
            </td>
            <td>{!! $goodsEvaluate->is_anonym==1?'匿名':'公开' !!}</td>
            <td>
                {!! Form::open(['route' => ['goodsEvaluates.destroy', $goodsEvaluate->id], 'method' => 'delete']) !!}
                <div class='btn-group'>
                    <button type="button" class='reply btn btn-default btn-xs' data-toggle="modal" data-target="#myModal" onclick="reply({{$goodsEvaluate->id,$goodsEvaluate->reply}},)">回复</button>
                    <a href="{!! route('orders.peisongdan', [$goodsEvaluate->order_id]) !!}" target="_blank" class='btn btn-default btn-xs'><i class="glyphicon glyphicon-eye-open"></i></a>
                    {{--<a href="{!! route('goodsEvaluates.show', [$goodsEvaluate->id]) !!}" class='btn btn-default btn-xs'><i class="glyphicon glyphicon-eye-open"></i></a>--}}
                    {{--<a href="{!! route('goodsEvaluates.edit', [$goodsEvaluate->id]) !!}" class='btn btn-default btn-xs'><i class="glyphicon glyphicon-edit"></i></a>--}}
                    {!! Form::button('<i class="glyphicon glyphicon-trash"></i>', ['type' => 'submit', 'class' => 'btn btn-danger btn-xs', 'onclick' => "return confirm('Are you sure?')"]) !!}
                </div>
                {!! Form::close() !!}
            </td>
        </tr>
    @endforeach
    </tbody>
</table>


@section('scripts')
    <script>
        function reply(id,content) {
            $('#content').html(content);
            $('#reply_id').val(id);
        };
    </script>
@endsection


@section('below_body')
    <!-- Modal -->
    <div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
        <div class="modal-dialog" role="document">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                    <h4 class="modal-title" id="myModalLabel">回复</h4>
                </div>

                {!! Form::open(['route' => 'goodsEvaluates.reply','method'=>'post']) !!}
                <input type="hidden" name="reply_id" id="reply_id" value="">
                <div class="modal-body">
                    <textarea name="reply_content" id="content" cols="70" rows="10"></textarea>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                    <button type="submit" class="btn btn-primary">添加</button>
                </div>
                {!! Form::close() !!}
            </div>
        </div>
    </div>
@endsection